<template>
  <div class="">
    我是 Chind-B组件

    <div>{{ $store.state.msg }}</div>

    <div>写法二：{{ msg }}</div>

    <!-- 取module里的数据 -->
    <div>{{ $store.state.user.special }}</div>
    <div>{{ $store.state.setting.set }}</div>

    <div>方法二：{{ user.special }}</div>
    <div>方法二：{{ set }}</div>

    <button @click="$store.commit('changeSpecial')">改变special</button>

    <hr />
    <input type="text" v-model="mymsg" />
    <button @click="addMsg">click</button>

    <router-link to="/">tochildA</router-link>
  </div>
</template>

<script>
import { mapGetters, mapState } from "vuex";
export default {
  name: "",
  data() {
    return {
      mymsg: ""
    };
  },
  watch: {},
  props: {},
  components: {},
  computed: {
    ...mapState(["user"]),
    ...mapGetters(["set"]),
    msg() {
      return this.$store.state.msg;
    }
  },
  mounted() {},
  methods: {
    addMsg() {
      this.$store.commit("addMsg", this.mymsg);
    }
  },
  filters: {}
};
</script>

<style scoped lang="css"></style>
